<template>
    <h2>显示会员登录信息</h2>
    <input type="button" value="导出" @click="daochu">
    <table border="1">
        <thead>
            <tr>
    <td>会员编号</td>
    <td>会员名称</td>
    <td>密码</td>
    <td>注册时间</td>
</tr>
        </thead>
        <tbody>
    <tr v-for="item in list">
    <td>{{item.m_Id}}</td>
    <td>{{item.m_Name  }}</td>
    <td>{{ item.m_Pwd }}</td>
    <td>{{moment(item.m_Date).format('YYYY-MM-DD HH:mm:ss')}}</td>
</tr>
        </tbody>
    </table>
</template>

<script setup lang="ts">
//moment插件来进行时间的精确存取
import axios from 'axios';
import { onMounted,reactive,toRefs } from 'vue';
import moment from 'moment';
const memberlist:any=reactive({
    state:{
    },
    list:[]

 })
const {state,list}=toRefs(memberlist);


//就绪函数
onMounted(()=>{
    getList();
})

const getList=()=>{
    axios({
        url:'/api/MemberLogin/ShowMember',
        method:'get',
        params:state.value
    })
    .then(res=>{
        console.log(res);
        list.value=res.data;
    })
    .catch(err=>{
        console.log(err);
    });
}
//导出操作
const daochu=()=>{
    location.href='https://localhost:7125/api/MemberLogin/ExportExcel';
}
</script>